package zhwtest;

import java.util.Arrays;
import java.util.Scanner;

public class HMain {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        String hbs = sc.nextLine();
        if (hbs.length() <=0) System.out.println("");
        String[] arr = hbs.split(",");
        Hangban[] hb = new Hangban[arr.length];
        for (int i = 0; i < arr.length; i++) {
            hb[i] = new Hangban(arr[i]);
        }
        Arrays.sort(hb);

        String ans = hb[0].hb;
        for (int i = 1; i < hb.length ; i++) {
            ans += "," + hb[i].hb;
        }
        System.out.println(ans);

    }
}

class Hangban implements Comparable<Hangban> {
    String hb;
    String sx;
    Integer num;
    public Hangban(String hbnum){
        this.hb = hbnum;
        sx = hbnum.substring(0,2);
        num = Integer.parseInt(hbnum.substring(hbnum.length() - 4,hbnum.length()));
    }

    @Override
    public int compareTo(Hangban o) {
        if (this.sx.equals(o.sx)) {
            return this.num.compareTo(o.num);
        }
        return this.sx.compareTo(o.sx);
    }
    public String getHb(){
        return hb;
    }
}
